

<?php if (isset($project)) { ?>
<!--<div id="move" style="width: 150px; height: 150px; background-color: rgb(255, 192, 203); border: 1px solid rgb(153, 153, 153); position: relative; left: 91px; top: 97px; " class="ui-draggable"> &nbsp; </div>-->
	
    


  
    <?php if (isset($SprintStories)){
        echo '<h1>'.'Sprint '.($this->params['pass'][1] + 1).': '.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h1>';
       
    }
    else{
          echo '<h1>Proyecto :'.$this->Html->link(h($project['Project']['name']),'view/'.$project['Project']['id']).'</h1>';

    }
         ?>
         <a href="<?php echo $this->base; ?>/projects/backlogGrid/<?php echo $project['Project']['id']; if (isset($SprintStories))echo '/'.($this->params['pass'][1]);?>" 
            class="btn btn-inverse pull-right"
            rel="tooltip" title="Vista Grilla">
             <i class="icon-th icon-white"></i>
         </a>
         <a href="<?php echo $this->base; ?>/projects/backlogCard/<?php echo $project['Project']['id']; if (isset($SprintStories))echo '/'.($this->params['pass'][1]);?>" 
            class="btn btn-inverse pull-right"
            rel="tooltip" title="Vista Tarjeta">
             <i class="icon-list-alt icon-white"></i>
         </a>
         <?php
    ?>
    <?php if (!isset($SprintStories)){?>
        <p><small>Created: <?php echo $project['Project']['created']; ?></small></p>
        <p><?php echo h($project['Project']['description']); ?></p>
    <?php } else {
        echo '<br/>';
    }
    ?>
    
    <?php if (isset($SprintStories)){
        $project['Story']=$SprintStories;
    } 
//    var_dump($project);
    ?>
    
    <div class="row-fluid " style=" margin-bottom: 20px;  margin-top: 20px;">
        <div class="span12">
            <div class="span2"></div>
            <div class="span3">
                <div class="bs-docs-example">
                    <div class="lead" align="center">
                        Total de Historias<br/> 
                        <?php echo ($project['Project']['terminadas']+$project['Project']['enProgreso']);?>
                    </div>
                 </div>
            </div>

            <div class="span3">
                <div class="bs-docs-example">
                    <div class="lead" align="center">
                        Historias Terminadas<br/> 
                        <?php echo $project['Project']['terminadas']?>
                    </div>
                </div>

            </div>
            <div class="span3">
                <div class="bs-docs-example">
                    <div class="lead" align="center">
                        Historias En Progreso<br/> 
                        <?php echo $project['Project']['enProgreso']?>
                    </div>
                </div>
            </div>
            <div class="span1"></div>
        </div>
    </div>
    
    <div class="row-fluid" >
        
        <div class="span12">
            <div class="span9">
                <h3>User Stories</h3>
            </div>
            <?php echo $this->element('stories/addStory')?>
            
        </div>
    </div>
    
    <br/>
    
        <?php
        

        for ($i=0; $i<count($stories);$i++){
           // var_dump($stories[$i]);

            ?>
            <div class="row-fluid"><div class="span12">
            <div class="bs-docs-example">
                <ul class="nav nav-pills pull-right">
                      <?php if ($permiso){ ?>
                    
                    <li>

                       
                        <a data-toggle="modal" href="#editStory<?php echo $stories[$i]['Story']['id'];?>" role="button"  ><i class="icon-edit"></i></a>
                        <?php 
                            echo $this->element('stories/editStory',array("story" => $stories[$i]['Story'],"pSprints" => $project['Project']['sprints'],"from"=>2));
                        
                        ?>
                    </li>
                     <?php } ?>
                     <li>
                        <a data-toggle="modal" href="#pokerStory<?php echo $stories[$i]['Story']['id'] ?>" role="button"  ><i class="icon-time"></i></a>
                        <?php
                            echo $this->element('stories/pokerStory',array("story" => $stories[$i],"from"=>2));

                        ?>
                    </li>
                    <?php if ($permiso){ ?>
                    <li>
                    <?php echo $this->Form->postLink(
                                    '<i class="icon-trash"></i>', //le image
                                    '/stories/delete/'.$stories[$i]['Story']['id'].'/1', //,le url
                                    array('escape' => false,'confirm' => 'Are you sure?','class' => 'nav-pills'));

                                ?>   
                    </li>
                     <?php } ?>
                </ul>
                <p> 
                    <?php echo $this->Html->link($i+1,array('controller'=>'stories','action'=>'view', $stories[$i]['Story']['id'])); ?>
                    
                    <?php echo $stories[$i]['Story']['summary']?>
                    <br/>
                    <?php echo $stories[$i]['Story']['detail']?>
                    <br/>
                    <?php echo $this->Html->link('Sprint: '.($stories[$i]['Story']['sprint']+1),'backlog/'.$project['Project']['id'].'/'.$stories[$i]['Story']['sprint']); ?>
                    <br/>
                    <?php $j=$stories[$i]['Story']['state']; ?>
                    <div class="progress progress-<?php 
                        if ($j==0)echo "danger";
                        if ($j==1)echo "warning";
                        if ($j==2)echo "info";
                        if ($j==3)echo "success";
                        ?>" style="height: 12px;  width: 50%;">
                        <div  class="bar" style="width: <?php 
                            if ($j==0)echo "0%";
                            if ($j==1)echo "36%";
                            if ($j==2)echo "66%";
                            if ($j==3)echo "100%";
                            ?>">
                        </div>
                    </div>
                
                </div>
            </div></div>
        <?php } ?>
     
    
<?php } else {?>
    <br/>
    <div class="alert alert-info">
        Error de acceso.
    </div>
<?php }?>


